package com.dailyblue.java.spring.ioc.work.work2;

import lombok.Data;

// 打印机
@Data
public class Printer {

    private Ink ink;
    private Paper paper;

    public void print(String message) {
        System.out.println("正在使用" + ink.getColor() + "打印");
        int lineSize = paper.getLineSize();
        for (int i = 0; i < message.length(); i++) {
            System.out.print(message.charAt(i));
            if ((i + 1) % lineSize == 0) {
                System.out.println();
            }
        }
    }
}
